package jnpf.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import jnpf.base.service.BillRuleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jnpf.base.ActionResult;
import jnpf.base.vo.PageListVO;
import jnpf.base.vo.PaginationVO;
import jnpf.base.UserInfo;
import jnpf.base.vo.DownloadVO;
import jnpf.config.ConfigValueUtil;
import jnpf.exception.DataException;
import org.springframework.transaction.annotation.Transactional;
import jnpf.base.entity.ProvinceEntity;
import jnpf.model.whu_comprehensiveability.*;
import jnpf.model.whu_comprehensiveability.Whu_comprehensiveabilityPagination;
import jnpf.model.whu_comprehensiveability.Whu_comprehensiveabilityCrForm;
import jnpf.model.whu_comprehensiveability.Whu_comprehensiveabilityInfoVO;
import jnpf.model.whu_comprehensiveability.Whu_comprehensiveabilityListVO;
import jnpf.model.whu_comprehensiveability.Whu_comprehensiveabilityUpForm;
import jnpf.entity.*;
import jnpf.base.service.ProvinceService;
import jnpf.util.*;
import jnpf.base.util.*;
import jnpf.base.vo.ListVO;
import jnpf.util.context.SpringContext;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import jnpf.entity.Whu_comprehensiveabilityEntity;
import jnpf.service.Whu_comprehensiveabilityService;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.*;


/**
 *
 * whu_comprehensiveability
 * @版本： V3.2.0
 * @版权： 引迈信息技术有限公司（https://www.jnpfsoft.com）
 * @作者： JNPF开发平台组
 * @日期： 2025-06-10
 */
@Slf4j
@RestController
@Api(tags = "whu_comprehensiveability" , value = "example")
@RequestMapping("/api/example/Whu_comprehensiveability")
public class Whu_comprehensiveabilityController {


    @Autowired
    private GeneraterSwapUtil generaterSwapUtil;
    @Autowired
    private UserProvider userProvider;

    @Autowired
    private Whu_comprehensiveabilityService whu_comprehensiveabilityService;



    /**
     * 列表
     *
     * @param whu_comprehensiveabilityPagination
     * @return
     */
	@PostMapping("/getList")
    public ActionResult list(@RequestBody Whu_comprehensiveabilityPagination whu_comprehensiveabilityPagination)throws IOException{
        List<Whu_comprehensiveabilityEntity> list= whu_comprehensiveabilityService.getList(whu_comprehensiveabilityPagination);
        //处理id字段转名称，若无需转或者为空可删除
    for(Whu_comprehensiveabilityEntity entity:list){
    }
	List<Whu_comprehensiveabilityListVO> listVO=JsonUtil.getJsonToList(list,Whu_comprehensiveabilityListVO.class);
    for(Whu_comprehensiveabilityListVO whu_comprehensiveabilityVO:listVO){
            }



        PageListVO vo=new PageListVO();
        vo.setList(listVO);
        PaginationVO page=JsonUtil.getJsonToBean(whu_comprehensiveabilityPagination,PaginationVO.class);
        vo.setPagination(page);
        return ActionResult.success(vo);
    }




    /**
    * 信息
    *
    * @param id
    * @return
    */
    @GetMapping("/{id}")
    public ActionResult<Whu_comprehensiveabilityInfoVO> info(@PathVariable("id") String id){
        Whu_comprehensiveabilityEntity entity= whu_comprehensiveabilityService.getInfo(id);
        Whu_comprehensiveabilityInfoVO vo=JsonUtil.getJsonToBean(entity, Whu_comprehensiveabilityInfoVO.class);

        return ActionResult.success(vo);
    }

    /**
     * 创建
     *
     * @param whu_comprehensiveabilityCrForm
     * @return
     */
    @PostMapping
    @Transactional
    public ActionResult create(@RequestBody @Valid Whu_comprehensiveabilityCrForm whu_comprehensiveabilityCrForm) throws DataException {
        String mainId =RandomUtil.uuId();
        UserInfo userInfo=userProvider.get();
        Whu_comprehensiveabilityEntity entity = JsonUtil.getJsonToBean(whu_comprehensiveabilityCrForm, Whu_comprehensiveabilityEntity.class);
        entity.setId(mainId);
        entity.setUserid(userInfo.getUserId());
        whu_comprehensiveabilityService.save(entity);


        return ActionResult.success("创建成功");
    }


}
